#方法一，暴力解法
class Solution:
    def increasingTriplet(self, nums: List[int]) -> bool:
        if len(nums) < 3:
            return False
        for i in range(len(nums)):
            for j in range(i + 1, len(nums)):
                if j == len(nums) - 2 and i == len(nums) - 3 and nums[j] <= nums[i]:
                    return False
                if nums[j] <= nums[i]:
                    continue
                for k in range(j + 1, len(nums)):
                    if k == len(nums) - 1 and j == len(nums) - 2 and i == len(nums) - 3 and nums[k] <= nums[j]:
                        return False
                    if nums[k] <= nums[j]:
                        continue
                    else:
                        return True

# 方法二：
class Solution:
    def increasingTriplet(self, nums: List[int]) -> bool:
        if len(nums) < 3:
            return False
        n = len(nums)
        first, second = nums[0], float('inf')
        for i in range(1, n):
            num = nums[i]
            if num > second:
                return True
            if num > first:
                second = num
            else:
                first = num
        return False